cmake_minimum_required(VERSION 3.5)
project(robot_odom_transform)

# Default to C99
if(NOT CMAKE_C_STANDARD)
  set(CMAKE_C_STANDARD 99)
endif()

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 14)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(diagnostic_msgs REQUIRED)
find_package(diagnostic_updater REQUIRED)
find_package(geographic_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(std_srvs REQUIRED)
find_package(tf2 REQUIRED)
find_package(tf2_eigen REQUIRED)
find_package(tf2_geometry_msgs REQUIRED)
find_package(tf2_ros REQUIRED)
find_package(tf2_sensor_msgs REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(Boost REQUIRED)
find_package(yaml_cpp_vendor REQUIRED)
find_package(geodesy REQUIRED)
find_package(robot_interfaces REQUIRED)
find_package(message_filters REQUIRED)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "/usr/share/cmake/geographiclib/")
find_package(GeographicLib REQUIRED)
# uncomment the following section in order to fill in
# further dependencies manually.
# find_package(<dependency> REQUIRED)

if(BUILD_TESTING)
  find_package(ament_lint_auto REQUIRED)
  # the following line skips the linter which checks for copyrights
  # uncomment the line when a copyright and license is not present in all source files
  #set(ament_cmake_copyright_FOUND TRUE)
  # the following line skips cpplint (only works in a git repo)
  # uncomment the line when this package is not in a git repo
  #set(ament_cmake_cpplint_FOUND TRUE)
  ament_lint_auto_find_test_dependencies()
endif()

# huangxiaoshuai add
add_executable(gps_kalman_filter_node src/gps_kalman_filter_node.cpp)
add_executable(tf_body_to_gps src/tf_body_to_gps.cpp)
add_executable(tf_odom_to_gps src/tf_odom_to_gps.cpp)
add_executable(odom_transform_pub src/odom_transform_pub.cpp)
add_executable(gps_to_utm_odometry_node src/gps_to_utm_odometry_node.cpp)
add_executable(utm_to_gps_odometry_node src/utm_to_gps_odometry_node.cpp)
add_executable(speed_monitoring_node src/speed_monitoring_node.cpp)
add_executable(test_transform_node src/test_transform_node.cpp)
add_executable(gps_signal_monitor_node src/gps_signal_monitor_node.cpp)
add_executable(test_extr_calib_node src/test_extr_calib_node.cpp)
add_executable(test_odometry_transformstamped src/test_odometry_transformstamped.cpp)

# jiabin add
add_executable(odom_to_gps_node src/odom_to_gps_node.cpp)



# huangxiaoshuai add
ament_target_dependencies(
  gps_kalman_filter_node
  rclcpp
  sensor_msgs
)

# huangxiaoshuai add
ament_target_dependencies(tf_body_to_gps
rclcpp
sensor_msgs
nav_msgs
tf2
tf2_ros
tf2_geometry_msgs
geometry_msgs
)
# huangxiaoshuai add
ament_target_dependencies(tf_odom_to_gps
rclcpp
sensor_msgs
nav_msgs
tf2
tf2_ros
tf2_geometry_msgs
geometry_msgs
)
# huangxiaoshuai add
ament_target_dependencies(odom_transform_pub
rclcpp
sensor_msgs
nav_msgs
tf2
tf2_ros
tf2_geometry_msgs
geometry_msgs
)
# huangxiaoshuai add
ament_target_dependencies(test_transform_node
rclcpp
sensor_msgs
nav_msgs
tf2
tf2_ros
tf2_geometry_msgs
geometry_msgs
)
# huangxiaoshuai add
ament_target_dependencies(test_odometry_transformstamped
rclcpp
sensor_msgs
nav_msgs
tf2
tf2_ros
tf2_geometry_msgs
geometry_msgs
)

# jiabin add
ament_target_dependencies(odom_to_gps_node
rclcpp
sensor_msgs
nav_msgs
geometry_msgs
GeographicLib
robot_interfaces
)

# huangxiaoshuai add
ament_target_dependencies(gps_to_utm_odometry_node rclcpp sensor_msgs nav_msgs GeographicLib robot_interfaces)
ament_target_dependencies(utm_to_gps_odometry_node rclcpp sensor_msgs nav_msgs GeographicLib robot_interfaces)
ament_target_dependencies(speed_monitoring_node rclcpp sensor_msgs nav_msgs GeographicLib robot_interfaces)
ament_target_dependencies(gps_signal_monitor_node rclcpp sensor_msgs std_msgs)
ament_target_dependencies(test_extr_calib_node rclcpp nav_msgs geometry_msgs Eigen3 message_filters)


install(
  TARGETS
  gps_kalman_filter_node  # huangxiaoshuai add
  tf_body_to_gps # huangxiaoshuai add
  tf_odom_to_gps # huangxiaoshuai add
  odom_transform_pub # huangxiaoshuai add
  gps_to_utm_odometry_node # huangxiaoshuai add
  utm_to_gps_odometry_node # huangxiaoshuai add
  speed_monitoring_node  # huangxiaoshuai add
  test_transform_node  # huangxiaoshuai add
  gps_signal_monitor_node  # huangxiaoshuai add
  odom_to_gps_node  # jiabin add
  test_extr_calib_node # huangxiaoshuai add
  test_odometry_transformstamped # huangxiaoshuai add
  DESTINATION lib/${PROJECT_NAME}
)

# 安装 launch文件
install(DIRECTORY
  launch
  DESTINATION share/${PROJECT_NAME}
)
ament_package()
